home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / perl / sprite / RCS / a2p.h,v < prev    next >
Encoding:
Text File  |  1991-11-14  |  6.9 KB  |  404 lines

  1. head     1.3;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.3
  10. date     91.11.14.12.50.57;  author jhh;  state Exp;
  11. branches ;
  12. next     1.2;
  13.  
  14. 1.2
  15. date     91.08.12.16.41.45;  author jhh;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     91.07.16.17.18.13;  author jhh;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @@
  27.  
  28.  
  29. 1.3
  30. log
  31. @finally got the include of config.h set up properly
  32. @
  33. text
  34. @/* $RCSfile: a2p.h,v $$Revision: 1.2 $$Date: 91/08/12 16:41:45 $
  35.  *
  36.  *    Copyright (c) 1991, Larry Wall
  37.  *
  38.  *    You may distribute under the terms of either the GNU General Public
  39.  *    License or the Artistic License, as specified in the README file.
  40.  *
  41.  * $Log:    a2p.h,v $
  42.  * Revision 1.2  91/08/12  16:41:45  jhh
  43.  * config.h is in a different place
  44.  * 
  45.  * Revision 1.1  91/07/16  17:18:13  jhh
  46.  * Initial revision
  47.  * 
  48.  * Revision 4.0.1.1  91/06/07  12:12:27  lwall
  49.  * patch4: new copyright notice
  50.  * 
  51.  * Revision 4.0  91/03/20  01:57:07  lwall
  52.  * 4.0 baseline.
  53.  * 
  54.  */
  55.  
  56. #define VOIDUSED 1
  57. #include "config.h"
  58.  
  59. #ifndef HAS_BCOPY
  60. #   define bcopy(s1,s2,l) memcpy(s2,s1,l)
  61. #endif
  62. #ifndef HAS_BZERO
  63. #   define bzero(s,l) memset(s,0,l)
  64. #endif
  65.  
  66. #include "handy.h"
  67. #define Nullop 0
  68.  
  69. #define OPROG        1
  70. #define OJUNK        2
  71. #define OHUNKS        3
  72. #define ORANGE        4
  73. #define OPAT        5
  74. #define OHUNK        6
  75. #define OPPAREN        7
  76. #define OPANDAND    8
  77. #define OPOROR        9
  78. #define OPNOT        10
  79. #define OCPAREN        11
  80. #define OCANDAND    12
  81. #define OCOROR        13
  82. #define OCNOT        14
  83. #define ORELOP        15
  84. #define ORPAREN        16
  85. #define OMATCHOP    17
  86. #define OMPAREN        18
  87. #define OCONCAT        19
  88. #define OASSIGN        20
  89. #define OADD        21
  90. #define OSUBTRACT    22
  91. #define OMULT        23
  92. #define ODIV        24
  93. #define OMOD        25
  94. #define OPOSTINCR    26
  95. #define OPOSTDECR    27
  96. #define OPREINCR    28
  97. #define OPREDECR    29
  98. #define OUMINUS        30
  99. #define OUPLUS        31
  100. #define OPAREN        32
  101. #define OGETLINE    33
  102. #define OSPRINTF    34
  103. #define OSUBSTR        35
  104. #define OSTRING        36
  105. #define OSPLIT        37
  106. #define OSNEWLINE    38
  107. #define OINDEX        39
  108. #define ONUM        40
  109. #define OSTR        41
  110. #define OVAR        42
  111. #define OFLD        43
  112. #define ONEWLINE    44
  113. #define OCOMMENT    45
  114. #define OCOMMA        46
  115. #define OSEMICOLON    47
  116. #define OSCOMMENT    48
  117. #define OSTATES        49
  118. #define OSTATE        50
  119. #define OPRINT        51
  120. #define OPRINTF        52
  121. #define OBREAK        53
  122. #define ONEXT        54
  123. #define OEXIT        55
  124. #define OCONTINUE    56
  125. #define OREDIR        57
  126. #define OIF        58
  127. #define OWHILE        59
  128. #define OFOR        60
  129. #define OFORIN        61
  130. #define OVFLD        62
  131. #define OBLOCK        63
  132. #define OREGEX        64
  133. #define OLENGTH        65
  134. #define OLOG        66
  135. #define OEXP        67
  136. #define OSQRT        68
  137. #define OINT        69
  138. #define ODO        70
  139. #define OPOW        71
  140. #define OSUB        72
  141. #define OGSUB        73
  142. #define OMATCH        74
  143. #define OUSERFUN    75
  144. #define OUSERDEF    76
  145. #define OCLOSE        77
  146. #define OATAN2        78
  147. #define OSIN        79
  148. #define OCOS        80
  149. #define ORAND        81
  150. #define OSRAND        82
  151. #define ODELETE        83
  152. #define OSYSTEM        84
  153. #define OCOND        85
  154. #define ORETURN        86
  155. #define ODEFINED    87
  156. #define OSTAR        88
  157.  
  158. #ifdef DOINIT
  159. char *opname[] = {
  160.     "0",
  161.     "PROG",
  162.     "JUNK",
  163.     "HUNKS",
  164.     "RANGE",
  165.     "PAT",
  166.     "HUNK",
  167.     "PPAREN",
  168.     "PANDAND",
  169.     "POROR",
  170.     "PNOT",
  171.     "CPAREN",
  172.     "CANDAND",
  173.     "COROR",
  174.     "CNOT",
  175.     "RELOP",
  176.     "RPAREN",
  177.     "MATCHOP",
  178.     "MPAREN",
  179.     "CONCAT",
  180.     "ASSIGN",
  181.     "ADD",
  182.     "SUBTRACT",
  183.     "MULT",
  184.     "DIV",
  185.     "MOD",
  186.     "POSTINCR",
  187.     "POSTDECR",
  188.     "PREINCR",
  189.     "PREDECR",
  190.     "UMINUS",
  191.     "UPLUS",
  192.     "PAREN",
  193.     "GETLINE",
  194.     "SPRINTF",
  195.     "SUBSTR",
  196.     "STRING",
  197.     "SPLIT",
  198.     "SNEWLINE",
  199.     "INDEX",
  200.     "NUM",
  201.     "STR",
  202.     "VAR",
  203.     "FLD",
  204.     "NEWLINE",
  205.     "COMMENT",
  206.     "COMMA",
  207.     "SEMICOLON",
  208.     "SCOMMENT",
  209.     "STATES",
  210.     "STATE",
  211.     "PRINT",
  212.     "PRINTF",
  213.     "BREAK",
  214.     "NEXT",
  215.     "EXIT",
  216.     "CONTINUE",
  217.     "REDIR",
  218.     "IF",
  219.     "WHILE",
  220.     "FOR",
  221.     "FORIN",
  222.     "VFLD",
  223.     "BLOCK",
  224.     "REGEX",
  225.     "LENGTH",
  226.     "LOG",
  227.     "EXP",
  228.     "SQRT",
  229.     "INT",
  230.     "DO",
  231.     "POW",
  232.     "SUB",
  233.     "GSUB",
  234.     "MATCH",
  235.     "USERFUN",
  236.     "USERDEF",
  237.     "CLOSE",
  238.     "ATAN2",
  239.     "SIN",
  240.     "COS",
  241.     "RAND",
  242.     "SRAND",
  243.     "DELETE",
  244.     "SYSTEM",
  245.     "COND",
  246.     "RETURN",
  247.     "DEFINED",
  248.     "STAR",
  249.     "89"
  250. };
  251. #else
  252. extern char *opname[];
  253. #endif
  254.  
  255. EXT int mop INIT(1);
  256.  
  257. union u_ops {
  258.     int ival;
  259.     char *cval;
  260. };
  261. #if defined(iAPX286) || defined(M_I286) || defined(I80286)     /* 80286 hack */
  262. #define OPSMAX (64000/sizeof(union u_ops))    /* approx. max segment size */
  263. #else
  264. #define OPSMAX 50000
  265. #endif                             /* 80286 hack */
  266. union u_ops ops[OPSMAX];
  267.  
  268. #include <stdio.h>
  269. #include <ctype.h>
  270.  
  271. typedef struct string STR;
  272. typedef struct htbl HASH;
  273.  
  274. #include "str.h"
  275. #include "hash.h"
  276.  
  277. /* A string is TRUE if not "" or "0". */
  278. #define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1])))
  279. EXT char *Yes INIT("1");
  280. EXT char *No INIT("");
  281.  
  282. #define str_true(str) (Str = (str), (Str->str_pok ? True(Str->str_ptr) : (Str->str_nok ? (Str->str_nval != 0.0) : 0 )))
  283.  
  284. #define str_peek(str) (Str = (str), (Str->str_pok ? Str->str_ptr : (Str->str_nok ? (sprintf(buf,"num(%g)",Str->str_nval),buf) : "" )))
  285. #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
  286. #define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_nval : str_2num(Str)))
  287. EXT STR *Str;
  288.  
  289. #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
  290.  
  291. STR *str_new();
  292.  
  293. char *scanpat();
  294. char *scannum();
  295.  
  296. void str_free();
  297.  
  298. EXT int line INIT(0);
  299.  
  300. EXT FILE *rsfp;
  301. EXT char buf[2048];
  302. EXT char *bufptr INIT(buf);
  303.  
  304. EXT STR *linestr INIT(Nullstr);
  305.  
  306. EXT char tokenbuf[2048];
  307. EXT int expectterm INIT(TRUE);
  308.  
  309. #ifdef DEBUGGING
  310. EXT int debug INIT(0);
  311. EXT int dlevel INIT(0);
  312. #define YYDEBUG 1
  313. extern int yydebug;
  314. #endif
  315.  
  316. EXT STR *freestrroot INIT(Nullstr);
  317.  
  318. EXT STR str_no;
  319. EXT STR str_yes;
  320.  
  321. EXT bool do_split INIT(FALSE);
  322. EXT bool split_to_array INIT(FALSE);
  323. EXT bool set_array_base INIT(FALSE);
  324. EXT bool saw_RS INIT(FALSE);
  325. EXT bool saw_OFS INIT(FALSE);
  326. EXT bool saw_ORS INIT(FALSE);
  327. EXT bool saw_line_op INIT(FALSE);
  328. EXT bool in_begin INIT(TRUE);
  329. EXT bool do_opens INIT(FALSE);
  330. EXT bool do_fancy_opens INIT(FALSE);
  331. EXT bool lval_field INIT(FALSE);
  332. EXT bool do_chop INIT(FALSE);
  333. EXT bool need_entire INIT(FALSE);
  334. EXT bool absmaxfld INIT(FALSE);
  335. EXT bool saw_altinput INIT(FALSE);
  336.  
  337. EXT char const_FS INIT(0);
  338. EXT char *namelist INIT(Nullch);
  339. EXT char fswitch INIT(0);
  340.  
  341. EXT int saw_FS INIT(0);
  342. EXT int maxfld INIT(0);
  343. EXT int arymax INIT(0);
  344. char *nameary[100];
  345.  
  346. EXT STR *opens;
  347.  
  348. EXT HASH *symtab;
  349. EXT HASH *curarghash;
  350.  
  351. #define P_MIN        0
  352. #define P_LISTOP    5
  353. #define P_COMMA        10
  354. #define P_ASSIGN    15
  355. #define P_COND        20
  356. #define P_DOTDOT    25
  357. #define P_OROR        30
  358. #define P_ANDAND    35
  359. #define P_OR        40
  360. #define P_AND        45
  361. #define P_EQ        50
  362. #define P_REL        55
  363. #define P_UNI        60
  364. #define P_FILETEST    65
  365. #define P_SHIFT        70
  366. #define P_ADD        75
  367. #define P_MUL        80
  368. #define P_MATCH        85
  369. #define P_UNARY        90
  370. #define P_POW        95
  371. #define P_AUTO        100
  372. #define P_MAX        999
  373. @
  374.  
  375.  
  376. 1.2
  377. log
  378. @config.h is in a different place
  379. @
  380. text
  381. @d1 1
  382. a1 1
  383. /* $RCSfile: a2p.h,v $$Revision: 1.1 $$Date: 91/07/16 17:18:13 $
  384. d9 3
  385. d24 1
  386. a24 1
  387. #include "../perl/config.h"
  388. @
  389.  
  390.  
  391. 1.1
  392. log
  393. @Initial revision
  394. @
  395. text
  396. @d1 1
  397. a1 1
  398. /* $RCSfile: a2p.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 12:12:27 $
  399. d9 3
  400. d21 1
  401. a21 1
  402. #include "../config.h"
  403. @
  404.